package com.cl.bootws.listener;


import com.cl.bootws.message.AbstractMessage;
import com.cl.bootws.util.JsonUtil;
import jakarta.websocket.Encoder;
import jakarta.websocket.EndpointConfig;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class WsMessageEncoder implements Encoder.Text<AbstractMessage> {
    @Override
    public void init(EndpointConfig endpointConfig) {
    }

    @Override
    public void destroy() {
    }

    @Override
    public String encode(AbstractMessage tm) {
        return JsonUtil.toString(tm);
    }
}
